#pragma once

class ShaderException : public StartupException, public std::exception
{
public:
	ShaderException(const std::string& message) : std::exception(message.c_str())
	{
		szBody = message;
		szTitle = "ShaderException";
	}
};

class ShaderManager : public Singleton<ShaderManager>
{
	IDirect3DDevice9* mDevice;
	std::map<std::string, Shader*> mShaders;
	std::set<ID3DXEffect*> mEffects;
public:
	ShaderManager(IDirect3DDevice9* pDevice);

	ID3DXEffect* GetShader(const std::string& fileName);
	Shader& getShader(const std::string& name);
	void onDeviceLost();
	void onDeviceReset();
};

#define sShaderMgr (*ShaderManager::GetInstance())